package top.tagao.multithread_02_use.way;



/**
 * @author fu-xiao-liu
 * @Date 2022/3/29 21:12
 */
public class Way_03_Join implements Runnable{
    @Override
    public void run() {
        for (int i = 0; i < 1000; i++) {
            System.out.println("线程 " + i);
        }
    }

    public static void main(String[] args) throws InterruptedException {
        Way_03_Join joinTest = new Way_03_Join();
        Thread t = new Thread(joinTest);
        t.start();
        // 当主线程跑到200  让 thread插队跑完，主线程再继续
        for (int i = 0; i < 500; i++) {
            System.out.println("主线程" + i);
            if(i == 200){
                t.join();
            }
        }
    }
}
